<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:rich="http://richfaces.ajax4jsf.org/rich"
      xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
      xmlns:t="http://myfaces.apache.org/tomahawk">

<ui:composition template="/layouts/application.xhtml">

<ui:define name="main_content_title">
	<h:outputText value="#{bean.titulo} :: Listando"></h:outputText>
</ui:define>

<ui:define name="main_content">
	<h:form>
       	<div id="form-compl" class="actions_div">
	       	<ui:insert name="ACOES">
				<h:commandButton  action="#{bean.exibirInclusao}" styleClass="enviar" value="Incluir" immediate="true"></h:commandButton>
			</ui:insert>
			<ui:insert name="OUTRAS_ACOES">
			</ui:insert>
		</div>
	</h:form>
   	
   	<ui:insert name="PESQUISA">
   	
   	</ui:insert>
	
	<p />
	<p />
	
	<h:form>
		<div id="form-compl">
					<rich:dataTable id="lista" value="#{bean.dadosPesquisa}" rendered="#{not empty bean.dadosPesquisa}" var="item" rows="20" styleClass="tb-comum listaPesquisa" rowClasses="cor1-row, cor2-row" >
						<ui:insert name="COLUNAS">
							<h:column>
								<f:facet name="header">
									<h:outputText value="# ERRO #"></h:outputText>
								</f:facet>
							</h:column>
						</ui:insert>
						<ui:insert name="COLUNA_ACOES">
							<h:column headerClass="colunaAcoes">
							    <f:facet name="header">
                                    <h:outputText value="Editar"/>
                                </f:facet>				
									<h:commandLink action="#{bean.exibirAlteracao}" title="Editar" immediate="true">
										<h:graphicImage value="/images/editar.png" />
										<f:setPropertyActionListener value="#{item}" target="#{bean.dadosForm}"/>					
									</h:commandLink>
							</h:column>
							<h:column headerClass="colunaAcoes">									
								<f:facet name="header">
                                    <h:outputText value="Excluir"/>
                                </f:facet>
									<h:commandLink action="#{bean.exibirExclusao}"  title="Excluir" immediate="true">
										<h:graphicImage value="/images/excluir.png" />
										<f:setPropertyActionListener value="#{item}" target="#{bean.dadosForm}"/>					
									</h:commandLink>
							</h:column>

	                        <ui:insert name="COLUNA_ACOES_DIREITA">
	                        </ui:insert>
						</ui:insert>
						<f:facet name="footer">                 			
                 			<rich:datascroller for="lista" pageIndexVar="pageIndex" pagesVar="pages">  
	            		        <f:facet name="pages">  
	                    	    	<h:outputText value="#{pageIndex}/#{pages}"/>  
	                     		</f:facet>  
                 			</rich:datascroller>
                 			  
			            </f:facet>
			            	
					</rich:dataTable>
					
					<t:saveState value="#{bean.dadosPesquisa}"/>  
					<t:saveState value="#{bean.dadosForm}"/>  
					<h:outputLabel value="Nenhum resultado a ser mostrado" rendered="#{empty bean.dadosPesquisa}" />
		</div>	
	</h:form>
</ui:define>

</ui:composition>

</html>
